package cn.gdcp.contentprovidetest;

import android.content.ContentProvider;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
     Button forContentResolverBtn;
     Button forContentProvideBtn;
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initMainActivityView();
        initBtnOnclick();
    }

    private void initBtnOnclick() {
        forContentResolverBtn.setOnClickListener(this);
        forContentProvideBtn.setOnClickListener(this);

    }

    private void initMainActivityView() {
          forContentProvideBtn=findViewById(R.id.for_contentProvide);
          forContentResolverBtn=findViewById(R.id.for_contentResolver);
    }

    public void onClick(View v) {
        switch (v.getId()){
            case R.id.for_contentProvide:
                startActivityForContentProvide();
                break;
            case R.id.for_contentResolver:
                startActivityForContentResolver();
                break;
            default:
                break;

        }


    }

    private void startActivityForContentResolver() {
        Intent intent=new Intent(this, ContentResolverTestActivity.class);
        startActivity(intent);

    }

    private void startActivityForContentProvide() {
        Intent intent=new Intent(this, ContentProviderTestActivity.class);
        startActivity(intent);
    }
}
